<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <base href="<%=basePath%>">
    <%--<title>${sessionScope.custom_item.title}</title>--%>
    <title>蓝牙电表项目</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="assets/css/admin/reset.css"/>
    <link rel="stylesheet" href="assets/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="assets/css/admin/admin.css">
    <link rel="stylesheet" href="assets/css/admin/index.css">
    <link rel="shortcut icon" href="assets/ico/favicon.png">
    <%--<link rel="stylesheet" href="//at.alicdn.com/t/font_893379_iu6ktqsodx.css">--%>
</head>
<body class="layui-layout-body">
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right" style="padding-right: 15px">
                <li class="layui-nav-item layui-hide-xs">
                    <a href="javascript:;" id="notice">
                        <i class="layui-icon layui-icon-notice"></i>
                        <!-- 如果有新消息，则显示小圆点 -->
                        <span class="layui-badge-dot" style="display: none;"></span></a>
                </li>

                <li class="layui-nav-item" lay-unselect="">
                    <a href="javascript:;"><img src="//t.cn/RCzsdCq" class="layui-nav-img">${adminName}</a>
                    <dl class="layui-nav-child">
                        <%--<input type="" value="${dataArr}" id="dataArr">--%>
                        <dd style="display: none" id="QRcode">
                            <div id="code"/>
                        </dd>
                        <dd><a onclick="javascript:editPassword();">修改密码</a>
                        </dd>
                        <dd><a href="logout">退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
                    lay-filter="layadmin-system-side-menu">

                    <c:forEach var="privilege" items="${privileges}">
                        <li data-name="get" class="layui-nav-item">
                            <c:choose>
                                <c:when test="${!empty privilege.resourceUrl}">
                                    <a href="javascript:;" lay-href="${privilege.resourceUrl}">
                                        <i class="layui-icon ${privilege.resourceIcon}"></i>
                                        <cite>${privilege.resourceName}</cite>
                                    </a>
                                </c:when>
                                <c:otherwise>
                                    <a href="javascript:;">
                                        <i class="layui-icon ${privilege.resourceIcon}"></i>
                                        <cite>${privilege.resourceName}</cite>
                                    </a>
                                    <c:if test="${!empty privilege.children}">
                                        <dl class="layui-nav-child">
                                            <c:forEach var="child" items="${privilege.children}">
                                                <dd><a lay-href="${child.resourceUrl}" >${child .resourceName}</a></dd>
                                            </c:forEach>
                                        </dl>
                                    </c:if>
                                </c:otherwise>
                            </c:choose>
                        </li>
                    </c:forEach>
                </ul>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li class="layui-this" layadmin-event="refresh"><i class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>


        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
<%--                <shiro:lacksPermission name="manufacturers">--%>
<%--                    <div>--%>
<%--                    <div id="optionA" style="width: 700px;height:400px;">--%>

<%--                    </div>--%>
<%--&lt;%&ndash;                        <table>&ndash;%&gt;--%>
<%--&lt;%&ndash;                            <thead>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <th>当日服务费收取:</th>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <th>当月服务费收取:</th>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <th>当年服务费收取:</th>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <th>总服务费收取:</th>&ndash;%&gt;--%>
<%--&lt;%&ndash;                            </thead>&ndash;%&gt;--%>
<%--&lt;%&ndash;                            <tbody>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <td>${stringDoubleMap.saleDay}元</td>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <td>${stringDoubleMap.saleMonth}元</td>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <td>${stringDoubleMap.saleYear}元</td>&ndash;%&gt;--%>
<%--&lt;%&ndash;                                <td>${stringDoubleMap.saleTotal}元</td>&ndash;%&gt;--%>
<%--&lt;%&ndash;                            </tbody>&ndash;%&gt;--%>
<%--&lt;%&ndash;                        </table>&ndash;%&gt;--%>
<%--                    <div style="">--%>
<%--                        <lable style="font-size: 18px">当日服务费收取:</lable><input value='${stringDoubleMap.saleDay}' readonly style="border: none;font-size: 18px;width: 98px">--%>
<%--                        <lable style="font-size: 18px">当月服务费收取:</lable><input value='${stringDoubleMap.saleMonth}' readonly style="border: none;font-size: 18px;width: 98px">--%>
<%--                        <lable style="font-size: 18px">当年服务费收取:</lable><input value='${stringDoubleMap.saleYear}' readonly style="border: none;font-size: 18px;width: 98px">--%>
<%--                        <lable style="font-size: 18px">总服务费收取:</lable><input value='${stringDoubleMap.saleTotal}' readonly style="border: none;font-size: 18px;width: 98px">--%>
<%--                    </div>--%>
<%--                    </div>--%>
<%--                </shiro:lacksPermission>--%>
                    <div id="optionB" style="width: 600px;height:400px;margin: 20px"></div>
            </div>
        </div>

        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>
<script type="text/html" id="barDemo">
    <a class="btn-white btn-primary layui-btn-xs" lay-event="see">查看</a>
</script>
<div id="changePasswordDiv" class="divHideLayer">
    <form class="layui-form" lay-filter="changePasswordForm" id="changePasswordForm">
        <table class="table_all">
            <tbody>
            <tr>
                <th>原密码</th>
                <td>
                    <input type="password" lay-verify="required|oldPassword" autocomplete="off" name="oldPassword"
                           class="layui-input layui-form-danger" placeholder="请输入原密码">
                </td>
            </tr>
            <tr>
                <th>新密码</th>
                <td>
                    <input type="password" lay-verify="required|newPassword" autocomplete="off" name="newPassword"
                           class="layui-input layui-form-danger" placeholder="请输入新密码">
                </td>
            </tr>
            <tr>
                <th>再次新密码</th>
                <td>
                    <input type="password" lay-verify="required" autocomplete="off" name="rNewPassword"
                           class="layui-input layui-form-danger" placeholder="请再次输入新密码">
                </td>
            </tr>
            </tbody>
        </table>
        <div class="layui-form-item">
            <div class="submitForm">
                <button class="layui-btn" type="button" lay-submit="" lay-filter="editSubmit">提交</button>
                <button type="button" class="layui-btn layui-btn-primary" id="cancel" onclick="hideTable(this)">取消
                </button>
            </div>
        </div>
    </form>
</div>
<div class="noticeDetail" id="noticeDetail" style="display: none">
    <h3 class="noticeTitle"></h3>
    <div class="noticeText">
    </div>
    <div class="layui-form-item">
        <div class="submitForm">
            <button type="button" class="layui-btn layui-btn-primary" id="cancel2" onclick="hideFun()">取消</button>
        </div>
    </div>
</div>
<div class="noticeAll" id="noticeAll">
    <%--<div class="noticeCover" id="noticeCover" style="display: none"></div>--%>
    <%--<div class="noticeDiv" id="noticeDiv">--%>
        <%--<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">--%>
            <%--<ul class="layui-tab-title">--%>
                <%--<li class="layui-this">全部消息</li>--%>
            <%--</ul>--%>
            <%--<div class="layui-tab-content" style="width: 580px">--%>
                <%--<table class="layui-table" id="noticeList" lay-filter="noticeList"></table>--%>
            <%--</div>--%>
        <%--</div>--%>
    <%--</div>--%>
</div>
<script src="assets/plugins/Jquery/jquery.min.js"></script>
<script src="assets/js/qrcode.min.js"></script>
<script src="assets/plugins/layui/layui.js"></script>
<script src="assets/plugins/lib/index.js"></script>
<script src="assets/plugins/jquery-md5/jquery.md5.js"></script>
<script src="assets/plugins/echarts/echarts.min.js"></script>
<script src="assets/js/custom/index.js"></script>
<script src="assets/js/common.js"></script>
<script>
    var adminId = '${admin.adminId}';
    var adminStatus = '${admin.adminStatus}';
<%--    <shiro:hasPermission name="zkis">--%>
<%--    var dataArr = ${dataArr};--%>
<%--    </shiro:hasPermission>--%>
<%--    <shiro:hasPermission name="dealer">--%>
<%--    var dataArr = ${dataArr};--%>
<%--    </shiro:hasPermission>--%>
    var qrcode = new QRCode("code", {
        text: adminId,
        width: 132,
        height: 132,
        colorDark : "#000000",
        colorLight : "#ffffff",
        correctLevel : QRCode.CorrectLevel.H
    });

    if(adminStatus==2){
        $("#QRcode").show()
    }

    $("#notice").on("click", function (e) {
        layer.open({
            type: 1,
            title: "修改密码",
            btnAlign: "c",
            offset: ['150px'],
            area: ['500px', '300px'],
            content: $("#changePasswordDiv"),
            end: function (i) {
                layer.close(i)
                hideWithReset("#changePasswordDiv", "#changePasswordForm")
            }
        });
    });

    function editPassword(){
        layer.open({
            type: 1,
            title: "修改密码",
            btnAlign: "c",
            offset: ['150px'],
            area: ['500px', '300px'],
            content: $("#changePasswordDiv"),
            end: function (i) {
                layer.close(i)
                hideWithReset("#changePasswordDiv", "#changePasswordForm")
            }
        });
    }

    function hideWithReset(hide, reset) {
        $(hide).hide()
        $(reset)[0].reset()
    }

    //生成图表
    // 基于准备好的dom，初始化echarts实例
<%--    <shiro:lacksPermission name="manufacturers">--%>
<%--    var myChartA = echarts.init(document.getElementById('optionA'));--%>
<%--    </shiro:lacksPermission>--%>
    var myChartB = echarts.init(document.getElementById('optionB'));

    // 指定图表的配置项和数据
    <%--<shiro:lacksPermission name="manufacturers">--%>
<%--    <shiro:hasPermission name="zkis">--%>
<%--    var optionA = {--%>
<%--        color: ['#AA00C9'],--%>
<%--        title: {--%>
<%--            text: '服务费收取数据'--%>
<%--        },--%>
<%--        tooltip: {},--%>
<%--        legend: {--%>
<%--            data:['销量']--%>
<%--        },--%>
<%--        xAxis: {--%>
<%--            data: ["一","二","三","四","五","六","七","八","九","十","十一","十二"]--%>
<%--        },--%>
<%--        yAxis: {},--%>
<%--        series: [{--%>
<%--            name: '服务费收取',--%>
<%--            type: 'bar',--%>
<%--            data: dataArr--%>
<%--        }]--%>
<%--    };--%>
    <%--</shiro:lacksPermission>--%>
<%--    </shiro:hasPermission>--%>
<%--    <shiro:hasPermission name="dealer">--%>
<%--    var optionA = {--%>
<%--        color: ['#AA00C9'],--%>
<%--        title: {--%>
<%--            text: '服务费收取数据'--%>
<%--        },--%>
<%--        tooltip: {},--%>
<%--        legend: {--%>
<%--            data:['销量']--%>
<%--        },--%>
<%--        xAxis: {--%>
<%--            data: ["一","二","三","四","五","六","七","八","九","十","十一","十二"]--%>
<%--        },--%>
<%--        yAxis: {},--%>
<%--        series: [{--%>
<%--            name: '服务费收取',--%>
<%--            type: 'bar',--%>
<%--            data: dataArr--%>
<%--        }]--%>
<%--    };--%>
<%--    &lt;%&ndash;</shiro:lacksPermission>&ndash;%&gt;--%>
<%--    </shiro:hasPermission>--%>
    var optionB = {
        color: ['#F16E0A','#9EAAA8'],
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b}: {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            x: 'left',
            textStyle: {
                fontSize: '20'
            },
            data:['电表激活数:'+${activate},'电表未激活数:'+${notactivate}]
        },
        series: [
            {
                name:'电表激活未激活数统计',
                type:'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    normal: {
                        show: false,
                        position: 'center'
                    },
                    emphasis: {
                        show: true,
                        textStyle: {
                            fontSize: '30',
                            fontWeight: 'bold'
                        }
                    }
                },
                labelLine: {
                    normal: {
                        show: true
                    }
                },
                data:[
                    {value:${activate}, name:'电表激活数:'+${activate}},
                    {value:${notactivate}, name:'电表未激活数:'+${notactivate}},
                ]
            }
        ]
    };
    <%--// 使用刚指定的配置项和数据显示图表。--%>
    <%--<shiro:hasPermission name="zkis">--%>
    <%--myChartA.setOption(optionA);--%>
    <%--</shiro:hasPermission>--%>
    <%--<shiro:hasPermission name="dealer">--%>
    <%--myChartA.setOption(optionA);--%>
    <%--</shiro:hasPermission>--%>
    myChartB.setOption(optionB);

</script>
</body>
</html>
